package com.etc.hotel.controller;

import com.etc.hotel.service.HotelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

@RestController
@RequestMapping("/hotel")
public class HotelController {

    @Autowired
    private HotelService hotelService;

    @RequestMapping("/list")
    public Map<String, Object> list() {
        Map<String, Object> resultMap = new HashMap<>();


        List<Map<String, Object>> maps = hotelService.list();

//        Set<Map.Entry<String, Object>> entrySet = hotels.entrySet();
//
//        for (Map.Entry<String, Object> entry : entrySet) {
//            System.out.println(entry.getKey() + "=" + entry.getValue());
//        }

        for (Map<String, Object> map : maps) {
            System.out.println(map);
        }

        resultMap.put("result", maps);

        return resultMap;
    }

}
